<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>访客管理 - 添加访客</h3>
                <h5>网站系统添加访客</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" method="post" id="add_form" enctype="multipart/form-data">
        <div class="ncap-form-default">
            <input type="hidden" name="id" id="id" class="input-txt" value="{$list.id}">
            <dl class="row">
                <dt class="tit">
                    <label for="name"><em>*</em>访客姓名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="name" id="name" class="input-txt" value="{$list.name}">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="phone"><em>*</em>手机号</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="phone" id="phone" class="input-txt" value="{$list.phone}">
                    <span class="err"></span>
                    <p class="notic">请输入11位手机号码</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="pic"><em>*</em>头像</label>
                </dt>
                <dd class="opt">
                    <input type="file" name="pic" id="pic" class="input-txt" value="{$list.pic}">
                    <img src="/public/upload/pic/{$list.pic|default='default.jpg'}" style="width: 50px;height: 50px;">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="address"><em>*</em>访问地址</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="address" id="address" class="input-txt" value="{$list.address}">
                    <span class="err"></span>
                    <p class="notic">需要访问的地址</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="aname"><em>*</em>邀请人姓名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="aname" id="aname" class="input-txt" value="{$list.aname}">
                    <span class="err"></span>
                    <p class="notic">请输入邀请人姓名</p>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" onclick="checkUserUpdate();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function checkUserUpdate(){
        var phone = $('input[name="phone"]').val();
        var name = $.trim($('input[name="name"]').val());
        var address = $.trim($('input[name="address"]').val());
        var error ='';
        if(name == ''){
            error += "姓名不能为空\n";
        }
        if(address == ''){
            error += "访问地址不能为空\n";
        }
        if(phone == ''){
            error += "手机号不能为空\n";
        }
        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        $('#add_form').submit();
    }
</script>
</body>
</html>